/**
 * Copyright(c) by JNet Smartware Group.
 * All rights reserved. Not distribution or redistribution without
 * any permission of JNet Smartware Group.
 * 
 * @author thuc
 * 2010/03/15
 */
package vn.smartware.co.server.dao.factory;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import vn.smartware.co.framework.bean.CommonItemBean;
import vn.smartware.co.framework.bean.MenuDTO;
import vn.smartware.co.framework.bean.AddressDTO;
import vn.smartware.co.framework.bean.UserDTO;
import vn.smartware.co.framework.bean.ProgramDTO;
import vn.smartware.co.framework.bean.LoginDTO;
import vn.smartware.co.framework.exception.ServerException;
import vn.smartware.co.framework.form.BaseForm;

/**
 * AbstractLoginDAO
 * @author thuctt
 */
public interface AbstractInitializeDAO {

	/**
	 * get menu
	 * @param user 
	 * 
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<MenuDTO> getMenu(LoginDTO user, Connection conn) throws ServerException;

	/**
	 * get program list
	 * 
	 * @param menu
	 * @param dto 
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<ProgramDTO> getPrgList(MenuDTO menu, LoginDTO dto, Connection conn)
			throws ServerException;

	/**
	 * getPrograms
	 * @param form
	 * @param user
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<ProgramDTO> getPrograms(BaseForm form,
			LoginDTO user, Connection conn) throws ServerException;

	/**
	 * register program
	 * @param prg
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void registerProgram(ProgramDTO prg, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * get only menu
	 * @param user
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<MenuDTO> getMenuListWithoutAuth(LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * create new menu
	 * @param dto
	 * @param user 
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void createNewMenu(MenuDTO dto, LoginDTO user, Connection conn)
			throws ServerException;

	/**
	 * update menu
	 * @param dto
	 * @param user 
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void updateMenu(MenuDTO dto, LoginDTO user, Connection conn)
			throws ServerException;

	/**
	 * delete menu
	 * @param dto
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void deleteMenu(MenuDTO dto, Connection conn)
			throws ServerException;

	/**
	 * create menu authority
	 * @param dto
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void createMenuAuthority(MenuDTO dto, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * get max menu ID
	 * @param conn
	 * @return int
	 * @throws ServerException
	 */
	abstract public int getMaxMenuId(Connection conn) throws ServerException;

	
	/**
	 * get initialize items data for combobox
	 * @param keyMap
	 * @param conn
	 * @return String[]
	 * @throws ServerException
	 */
	abstract public List<CommonItemBean> getComboInitItems(Map<Object, Object> keyMap,
			Connection conn) throws ServerException;

	/**
	 * Clear all rows in table ACTIONLOG
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void clearLog(Connection conn) throws ServerException;

	/**
	 * delete authority
	 * @param dto
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void deleteAuth(MenuDTO dto, Connection conn)
			throws ServerException;

	/**
	 * get user list
	 * @param form
	 * @param user
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<UserDTO> getUsers(BaseForm form, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * deleteUser
	 * @param dto
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void deleteUser(UserDTO dto, Connection conn)
			throws ServerException;

	/**
	 * deleteAuthOfUser
	 * @param dto
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void deleteAuthOfUser(UserDTO dto, Connection conn)
			throws ServerException;

	/**
	 * register new user
	 * @param dto
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void registerLoginInfo(UserDTO dto, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * update a user
	 * @param dto
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void updateLoginUser(UserDTO dto, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * insert new address
	 * @param addr
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void insertAddress(AddressDTO addr, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * update address
	 * @param addr
	 * @param user
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void updateAddress(AddressDTO addr, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * get max addressCd
	 * @param addr
	 * @param user
	 * @param conn
	 * @return int
	 * @throws ServerException
	 */
	abstract public int getMaxAddressCd(AddressDTO addr, LoginDTO user,
			Connection conn) throws ServerException;

	/**
	 * get max userID
	 * @param conn
	 * @return int
	 * @throws ServerException
	 */
	abstract public int getMaxUserID(Connection conn)
			throws ServerException;

	/**
	 * get program list of current login user
	 * @param userId
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<ProgramDTO> getAuthPrograms(String userId, Connection conn)
			throws ServerException;

	/**
	 * register auth
	 * @param prg
	 * @param userID 
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void registerAuth(ProgramDTO prg, String userID,
			Connection conn) throws ServerException;

	/**
	 * deleteAllPrgsOfUser
	 * @param form
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void deleteAllPrgsOfUser(BaseForm form, Connection conn)
			throws ServerException;

	/**
	 * getAvailableMenu
	 * @param conn
	 * @return ArrayList
	 * @throws ServerException
	 */
	abstract public ArrayList<MenuDTO> getAvailableMenu(Connection conn)
			throws ServerException;

	/**
	 * deleteAddress
	 * @param addr
	 * @param conn
	 * @throws ServerException
	 */
	abstract public void deleteAddress(AddressDTO addr, Connection conn)
			throws ServerException;

}
